package ma.ensao.evalmetrics.controller.metrics;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;

import ma.ensao.evalmetrics.model.NOI;

public class NOIManager {
	private NOI noi = new NOI();
	int interf = 0;

	List<String> ListInterf;

	public NOIManager() {

	}

	public NOI read(File file) throws IOException {

		InputStream ips = new FileInputStream(file);
		InputStreamReader ipsr = new InputStreamReader(ips);
		BufferedReader br = new BufferedReader(ipsr);
		String ligne;

		while ((ligne = br.readLine()) != null) {
			ligne = ligne.replaceAll(" ", "");
			if (ligne.contains("interface")
					&& ligne.contains("{")) {
				interf++;
			}

		}
		br.close();

		noi.setInterf(interf);

		return noi;
	}

	public List<String> getListInterf() {
		return ListInterf;

	}

	public int getInterf() {
		return interf;
	}

}